﻿using System;
using wojilu.ORM;
using wojilu.Web.Mvc;

namespace wojilu.Apps.Qycms.Domain
{
    [Table("ybb_bbs_typelist")]
    [Serializable]
    public class Bbs_TypeList : ObjectBase<Bbs_TypeList>
    {
        [NotNull(""), Default(50), Column(Length = 11)]
        public Int32 pid { get; set; }

        [NotNull(""), Column(Length = 50), Default("cn")]
        public String lng { get; set; }

        [NotNull(""), Column(Length = 200)]
        public String typename { get; set; }

        [LongText]
        public String content { get; set; }

        [TinyInt, Column(Length = 1), NotNull(""), Default(0)]
        public Int32 purview { get; set; }

        [TinyInt, Column(Length = 1), NotNull(""), Default(1)]
        public Int32 ispage { get; set; }

        [TinyInt, Column(Length = 1), NotNull(""), Default(1)]
        public Int32 isclass { get; set; }

        [NotNull("")]
        public DateTime addtime { get; set; }

        [TinyInt, Column(Length = 3), NotNull(""), Default(10)]
        public Int32 pagemax { get; set; }

        [TinyInt, Column(Length = 3), NotNull(""), Default(10)]
        public Int32 listmax { get; set; }

        [TinyInt, Column(Length = 1), NotNull(""), Default(0)]
        public Int32 isaddclass { get; set; }

        [TinyInt, Column(Length = 1), NotNull(""), Default(1)]
        public Int32 ismail { get; set; }

        [Column(Length = 100)]
        public String putmail { get; set; }

        [Column(Length = 100)]
        public String mailcode { get; set; }

        [TinyInt, Column(Length = 1), NotNull(""), Default(1)]
        public Int32 ismenu { get; set; }

        [TinyInt, Column(Length = 1), NotNull(""), Default(0)]
        public Int32 isseccode { get; set; }

        [Column(Length = 5), NotNull(""), Default(0)]
        public Int32 inputtime { get; set; }

        [TinyInt, Column(Length = 1), NotNull(""), Default(1)]
        public Int32 iswap { get; set; }

        [TinyInt, Column(Length = 1), NotNull(""), Default(0)]
        public Int32 istemplates { get; set; }

        [Column(Length = 100)]
        public String templates { get; set; }

        [TinyInt, Column(Length = 1), NotNull(""), Default(0)]
        public Int32 issms { get; set; }

        [Column(Length = 100)]
        public String smscode { get; set; }

        [NotSave]
        public String puvname
        {
            get
            {
                if (purview == 0)
                {
                    return wojilu.lang.get("puv_no");
                }
                else
                {
                    var mc = Member_Class.findById(purview);
                    return mc.rankname;
                }
            }
        }

        [NotSave]
        public String glink
        {
            get
            {
                return strUtil.Join(strUtil.Join(strUtil.Join(sys.Path.Root, "Message"), "List"), Id.ToString()) + MvcConfig.Instance.UrlExt;
            }
        }

    }
}
